---
title: "Covid-19 Dashboard by Me :')"
output:
flexdashboard::flex_dashboard:
orientation: rows
social: menu
vertical_layout: fill
theme: cerulean
source_code: embed
---
```{r setup, include=FALSE}
library(flexdashboard)
library(tidyverse)
library(leaflet)
load("datafinal.Rdata")
load("df.Rdata")
#source("Data manipulation.R",local = T)
```
Overview
====================================================================
Sidebar{.sidebar}
---------------------------------------------------------------
Last updated:
```{r}
library(lubridate)
d <- Sys.Date()-1
paste(day(d),months(d),",2020")
```
_About :_
My name is **Md Asrafur Rahman Ashiq**.I am a student of the department of Statistics at University of Dhaka,Bangladesh.I tried to build this dashboard.It's my first dashboard.Any kinds of mistake should be forgiven and mentioned.
Data source: ```coronavirus``` package from Comprehensive R Archive Network**(CRAN)**.
[Know more about this project]("https://github.com/asrafurashiq/asrafurashiq.github.io")
Symptoms of Covid-19:
Most common symptoms:
1.fever
2.dry cough
3.tiredness
Less common symptoms:
4.aches and pains
5.sore throat
6.diarrhoea
7.conjunctivitis
8.headache
9.loss of taste or smell
[My Facebook profile]("https://www.facebook.com/mohammadasrafur.rahmanashiq")
Row
----------------------------------------------
### Worldwide Confirmed {.value-box}
```{r}
valueBox(value = paste(format(sum(df$cases_new,na.rm = T), big.mark = ","), "", sep = " "),
caption = "Total Confirmed Cases",
icon = "fas fa-user-md",
color ="violet")
```
### Death {.value-box}
```{r}
valueBox(value = paste(format(sum(df$deaths_new, na.rm = TRUE), big.mark = ","), " (",
round(100 * sum(df$deaths_new, na.rm = TRUE) / sum(df$cases_new,na.rm = T), 1),
"%)", sep = " "),
caption = "Death Cases",
icon = "fa-heartbeat",
color = "#FF3333")
```
### Recovered {.value-box}
```{r}
valueBox(value = paste(format(sum(df$recovered_new, na.rm = TRUE), big.mark = ","), " (",
round(100 * sum(df$recovered_new, na.rm = TRUE) / sum(df$cases_new,na.rm = T), 1),
"%)", sep = ""),
caption = "Recovered Cases",
icon = "fa-walking",
color = "#33FFCC")
```
Row {.tabset}
------------------------------------------------------------------
### Top affected countries
```{r}
library(highcharter)
df%>%filter(location %in% df$location[1:12])%>%
hchart("column",hcaes(x=location,y=cases_new,color=location),name="Confirmed Cases",dataLabels = list(align = "center", enabled = TRUE)) %>%hc_yAxis(title=list(text="Total confirmed case")) %>%hc_xAxis(title="")%>%hc_add_theme(hc_theme_ggplot2())
```
### Countries over date
```{r}
data %>% filter(location %in% df$location[1:10]) %>% group_by(location,date) %>%
summarise(sum=sum(value))%>% mutate(cum=cumsum(sum)) %>% hchart("line",hcaes(x=date,y=cum,group=location))%>%hc_yAxis(title=list(text="Cumulative Confirmed cases")) %>%hc_add_theme(hc_theme_ggplot2())
```
Row {.tabset}
------------------------------------------------------------
### Top recovered countries
```{r}
r <- df %>%arrange(-recovered_new)
r %>% filter(location %in% r$location[1:12])%>%
hchart("column",hcaes(x=location,y=recovered_new,color=location),name="Recovered",dataLabels = list(align = "center", enabled = TRUE)) %>% hc_yAxis(title=list(text="Total Recovered case")) %>%hc_xAxis(title="") %>%hc_add_theme(hc_theme_ggplot2())
```
### Top countries with death
```{r}
df%>%filter(location %in% df$location[1:12])%>%
hchart("column",hcaes(x=location,y=deaths_new,color=location),name="Deaths :",dataLabels = list(align = "center", enabled = TRUE)) %>%hc_yAxis(title=list(text="Total death cases")) %>%hc_xAxis(title="")
```
World Map
================================================================
Sidebar{.sidebar}
---------------------------------------------------------------
Wikipedia says,In December 2019, a pneumonia outbreak was reported in Wuhan, China.On 31 December 2019, the outbreak was traced to a novel strain of coronavirus, which was given the interim name 2019-nCoV by the World Health Organization (WHO), later renamed SARS-CoV-2 by the International Committee on Taxonomy of Viruses.
As of **15 August 2020**, there have been at least 765,029 confirmed deaths and more than 21,173,009 confirmed cases in the COVID-19 pandemic. The Wuhan strain has been identified as a new strain of Betacoronavirus from group 2B with approximately 70% genetic similarity to the SARS-CoV.[114] The virus has a 96% similarity to a bat coronavirus, so it is widely suspected to originate from bats as well. The pandemic has resulted in travel restrictions and nationwide lockdowns in many countries.
Column {data-width=650}
-----------------------------------------------------------------------
### Countries with more than 50k confirmed cases(click the markers for details)
```{r fig.height=6.4}
df %>%
filter(cases_new>50000) %>% leaflet()%>%addTiles()%>%
addProviderTiles("Esri.WorldImagery")%>%setView(0,0,zoom = 2.3)%>%
addMarkers(lat = ~lat,lng = ~long,popup = ~paste(sep=" ",location,"Confirmed Cases :",cases_new,",",
" Deaths :",deaths_new,",","Recovered :",recovered_new),
label = ~paste0(location," (Click for details)"),
labelOptions = labelOptions(textsize = "18px"),
popupOptions = popupOptions(maxWidth = 200))
```
Situation of Bangladesh
===============================================================
Sidebar{.sidebar}
------------------------------------------------------------
Wikipedia says,The COVID-19 pandemic in Bangladesh is part of the worldwide pandemic of coronavirus disease 2019 (COVID-19) caused by severe acute respiratory syndrome coronavirus 2 (SARS-CoV-2). The virus was confirmed to have spread to Bangladesh in March 2020. The first three known cases were reported on 8 March 2020 by the country's epidemiology institute, IEDCR. Since then, the pandemic has spread day by day over the whole nation and the number of affected people has been increasing.
Row
----------------------------------------------
### Worldwide Confirmed {.value-box}
```{r}
dfb <- df %>% filter(location=="Bangladesh")
valueBox(value = paste(format(sum(dfb$cases_new,na.rm = T), big.mark = ","), "", sep = " "),
caption = "Total Confirmed Cases",
icon = "fas fa-user-md",
color ="violet")
```
### Death {.value-box}
```{r}
valueBox(value = paste(format(sum(dfb$deaths_new, na.rm = TRUE), big.mark = ","), " (",
round(100 * sum(dfb$deaths_new, na.rm = TRUE) / sum(dfb$cases_new,na.rm=T), 1),
"%)", sep = ""),
caption = "Death Cases",
icon = "fa-heartbeat",
color = "#FF3333")
```
### Recovered {.value-box}
```{r}
valueBox(value = paste(format(sum(dfb$recovered_new, na.rm = TRUE), big.mark = ","), " (",
round(100 * sum(dfb$recovered_new, na.rm = TRUE) / sum(dfb$cases_new,na.rm=T), 1),
"%)", sep = ""),
caption = "Recovered Cases",
icon = "fa-walking",
color = "#33FFCC")
```
Column
---------------------------------------------------------------
### Districts with more than 2500 confirmed cases(This map was last updated on 15 August,2020.)
```{r fig.height=5}
library(sf)
bd <- read_sf("Bangladesh data/BGD_adm2.shp")
district <- readxl::read_xlsx("Bangladesh data/COVID-19.xlsx")
#district <- district %>% mutate_geocode(District,source='dsk')
#save(district,file="lat lon district.Rdata")
load("lat lon district.Rdata")
district <- district %>% mutate(lab=ifelse(Cases>2500,paste(District,Cases),NA))
m <- ggplot(bd)+geom_sf(aes(fill=NAME_2))+
geom_point(data=district,aes(x=lon,y=lat,size=Cases),col="red")+
ggrepel::geom_label_repel(data=district,aes(x=lon,y=lat,label=as.character(lab),alpha=.5))+theme_minimal()+theme(legend.position = "")
m
```
### Overall Scenario of Bangladesh
```{r}
data$data_type <- str_replace(data$data_type,"_new","")
data %>% filter(location=="Bangladesh") %>%
group_by(data_type,date) %>%
summarise(sum_case=sum(value))%>%
mutate(cum_case=cumsum(sum_case)) %>% hchart("line",hcaes(x=date,y=cum_case,group=data_type,),dataLabels = list(align = "center", enabled = TRUE)) %>% hc_yAxis(title=list(text="Cumulative Total"))%>% hc_colors(c("#0073C2FF", "#EFC000FF","red")) %>% hc_add_theme(hc_theme_ggplot2())
```
Data Table
===============================================
Sidebar{.sidebar}
------------------------------------------------
The data associated in this dashboard was downloaded from the ```coronavirus``` package from Comprehensive R Archive Network***(CRAN).***
You can get the data by running the following code in **R**:
```
install.packages("coronavirus")
library(coronavirus)
covid_data <- refresh_coronavirus_jhu()
head(covid_data,10)
```
Row
----------------------------------------------------
### DataTable
```{r}
d <- df%>%select(-lat,-long) %>% rename(Cases=cases_new,
Deaths=deaths_new,
Recovered=recovered_new)
d$lat <- NULL
DT::datatable(d)
```
About
========================================================
Sidebar{.sidebar}
---------------------------------------------------------
I am a young data science enthusiasist and this is my first dashboard.It was built using R prgoramming language and the data was collected from the ```coronavirus``` package.
Row
---------------------------------------------------------
```{r fig.height=8, fig.width=6}
library(magick)
image_read("resized.jpg")
```